import Vue from 'vue'
import VueRouter from 'vue-router'
import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/destination',
    name: 'destination',
    component: () => import('../views/Destination.vue')
  },
  {
    path: '/strategyIndex',
    name: 'strategyIndex',
    component: () => import('../views/StrategyIndex.vue')
  },
  {
    path: '/travelIndex',
    name: 'travelIndex',
    component: () => import('../views/TravelIndex.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/regist',
    name: 'regist',
    component: () => import('../views/Regist.vue')
  },
  {
    path: '/destinationdetail',
    name: 'destinationdetail',
    component: () => import('../views/Destinationdetail.vue')
  },
  {
    path: '/traveldetail',
    name: 'traveldetail',
    component: () => import('../views/Traveldetail.vue')
  },
  {
    path: '/strategydetail',
    name: 'strategydetail',
    component: () => import('../views/Strategydetail.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
